package com.automannn.seataSamples.account.dubbo;

import com.automannn.seataSamples.account.service.IAccountService;
import com.automannn.seataSamples.api.dto.AccountDTO;
import com.automannn.seataSamples.api.response.ObjectResponse;
import com.automannn.seataSamples.api.service.AccountService;
import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author automannn
 * @Date 2022/3/24
 */
@DubboService(version = "1.0.0", protocol = "${dubbo.protocol.id}", application = "${dubbo.application.id}",
        registry = "${dubbo.registry.id}", timeout = 3000,group = "automannn")
@Slf4j
public class AccountServiceImpl implements AccountService {
    @Autowired
    private IAccountService accountService;

    @Override
    public ObjectResponse decreaseAccount(AccountDTO accountDTO) {
        log.info("全局事务id ：" + RootContext.getXID());
        return accountService.decreaseAccount(accountDTO);
    }
}
